<template>
    <el-row>
        <el-col>
            用户<el-input
                v-model="user"
                style="width: 90%; padding: 0 10px"
                placeholder="Please input"
                clearable
            />
        </el-col>
        <el-col>
            标题<el-input
                v-model="title"
                style="width: 90%; padding:  10px"
                placeholder="Please input"
                clearable
            />
        </el-col>
        <el-col style="text-align: right">
            <el-button @click="cancle">取消</el-button>
            <el-button style="margin-right: 20px" @click="save">保存</el-button>
        </el-col>
    </el-row>
</template>
<script setup>
    import { ref, defineEmits } from 'vue'
    const emites = defineEmits(['add'])
    let title = ref()
    let user = ref()
    let time = ref()
    let time1 = ref()
    time1.value = new Date().toDateString()
    let time2 = ref()
    time2.value = new Date().toLocaleTimeString()
    time.value = time1.value + ' ' + time2.value + ' GMT+0800'
    console.log(time1.value)
    console.log(time2.value)

    const save = function () {
        emites('add', {
            user: user.value,
            title: title.value,
            time: time.value,
            del: 1
        })
    }
    const cancle = function () {
        emites('add')
    }
</script>